package com.x.erp.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.dao.CarValuationDao;
import com.x.erp.model.CarValuation;
import com.x.erp.rpc.CarValuationRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Service(interfaceName = "com.x.erp.rpc.CarValuationRpcService", timeout = 60000)
public class CarValuationService extends BaseService implements CarValuationRpcService {

	@Autowired
	private CarValuationDao carValuationDao;//车辆估值DAO

	/**
	 * 批量添加车辆估值信息
	 * @param carId
	 * @param carValuations
	 * @return
	 * @throws Exception
	 */
	public void insertCarValuationList(String carId, List<CarValuation> carValuations){
		try {
			carValuationDao.insertCarValuationList(carId, carValuations);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

}
